#include "SqlResult.h"


LIBDBC_BEGIN_NAMESPACE

const char* gszFieldTypeNames[] = 
{
	"unkown", "varchar", "char", "tinyint", "smallint",
	"integer", "decimal", "float", "double", "date",
	"time", "timestamp", "datetime", "year", "blob",
	"complex", "bit", "GUID", "null"
};


SqlResult::SqlResult()
{
	_metaData = NULL;
	_connection = NULL;
	_errorcode = 0;
}


SqlResult::~SqlResult()
{
	if (_metaData)
		delete _metaData;

	_metaData = NULL;
}

void SqlResult::setConnection(IDatabase* con)
{
	_connection = con;
}

unsigned int SqlResult::getColumnCount()
{
	return 0;
}

IResultSetMetaData* SqlResult::getResultSetMetaData()
{
	return _metaData;
}

char* SqlResult::getFieldName(int field, char* buffer, int len)
{
	if (len > 0)
		buffer[0] = 0;
	return buffer;
}

const char* SqlResult::getFieldTypeName(int field)
{
	return gszFieldTypeNames[static_cast<int>(getFieldType(field))];
}

DBCFieldType SqlResult::getFieldType(int field)
{
	return DBC_TYPE_UNKNOWN;
}

bool SqlResult::next()
{
	return false;
}

char* SqlResult::getString(int field, char* buffer, int len)
{
	if (len>0)
		buffer[0] = 0;
	return buffer;
}

int SqlResult::getInt(int field)
{
	return 0;
}

long SqlResult::getLong(int field)
{
	return 0;
}

double SqlResult::getDouble(int field)
{
	return 0;
}

bool SqlResult::getStringExt(int field, char* buffer, int len)
{
	//__myDebugBreak();
	return false;
}

bool SqlResult::getInt(int field, int* pvalue)
{
	//__myDebugBreak();
	return false;
}

bool SqlResult::getLong(int field, long* pvalue)
{
	//__myDebugBreak();
	return false;
}

bool SqlResult::getDouble(int field, double* pvalue)
{
	//__myDebugBreak();
	return false;
}

bool SqlResult::getBinaryLength(int field, unsigned long* len)
{
	//__myDebugBreak();
	return false;
}
bool SqlResult::getBinary(int field, unsigned char* pBuffer, int buflen)
{
	//__myDebugBreak();
	return false;
}

int SqlResult::getLastErrorCode()
{
	return _errorcode;
}

LIBDBC_END_NAMESPACE